<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		onLaunch: function() {
			console.log('App Launch')
			uni.getStorage({
				key: 'token',
				success(res) {
					if (res.data == "") {
						uni.reLaunch({
							url: "/pages/login/accountlogin"
						})
					}
					// else{
					// 	uni.reLaunch({
					// 		url:"/pages/homepage/homepage"
					// 	})
					// }
				},
				fail(err) {
					console.log(err, "错误信息")
					uni.reLaunch({
						url: "/pages/login/accountlogin"
					})
				}
			});
			// let _this = this
			// let thetime = this.datechange(new Date())
			// let lasttime = ""
			// let outside = false
			// setInterval(() => {
			// 	uni.getStorage({
			// 		key: 'timer',
			// 		success(res) {
			// 			lasttime = res.data
			// 		}
			// 	});
			// 	uni.getStorage({
			// 		key: 'outside',
			// 		success(res) {
			// 			outside = res.data
			// 		}
			// 	});
			// 	if (thetime == lasttime && outside) {
			// 		_this.getlocation()
			// 		console.log('记录轨迹')
			// 	}
			// }, 10000)
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			getlocation() {
				let _this = this
				uni.getLocation({
					type: 'gcj02',
					geocode: true,
					success: function(res) {
						let ars = res.address
						let address = ars.province + ars.city + ars.district + ars.street + ars.streetNum +
							ars.poiName
						let lat = res.latitude
						let lng = res.longitude
						console.log("记录地址")
						_this.getrecordTrack(address, lat, lng)

					}
				});
			},
			getrecordTrack(address, lat, lng) {
				httpRequest.request('appapi/manage/staff/record_track', 'POST', {
					address: address,
					lat: lat,
					lng: lng
				}, false, false, true).then(res => {
					console.log("接口调用成功，经纬度：", lat, lng, "地址", address)
				})
			},
			datechange(timer) {
				var date = new Date(timer); //当前时间
				var year = date.getFullYear() //返回指定日期的年份
				var month = repair(date.getMonth() + 1); //月
				var day = repair(date.getDate()); //日
				var curTime = year + "-" + month + "-" + day

				function repair(i) {
					if (i >= 0 && i <= 9) {
						return "0" + i;
					} else {
						return i;
					}
				}
				return curTime
			},
		}
	}
</script>
<style lang="scss">
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
	@import "uview-ui/index.scss";
	@import url("static/css/main.css");
</style>
<style lang="scss">
	.savebtn {
		width: 300rpx;
		padding: 20rpx 0;
		text-align: center;
		background-color: #3476fe;
		color: #fff;
		font-size: 32rpx;
		border-radius: 50rpx;
	}
	.rightmsg_content {
		.img {
			width: 40rpx;
			height: 40rpx;
		}
	}

	// 语音
	.yuyin {
		background-image: url('@/static/image/system/yuyin.png');
		background-size: 100% 100%;
		width: 46rpx;
		height: 46rpx;
	}

	/*每个页面公共css */
	.mainpadding {
		padding: 30rpx;
	}

	.mainpadding_top {
		padding: 30rpx;
		margin-top: 30rpx;
		box-sizing: border-box;
	}

	.namecolor {
		margin-left: 20rpx;
		color: #0BBDCB;
	}

	.mainpadding2 {
		padding: 0 30rpx 30rpx 30rpx;
	}

	.margin_top {
		margin-top: 30rpx;
	}

	.margin_top2 {
		margin-top: 20rpx;
	}

	.margin_top1 {
		margin-top: 10rpx;
	}

	.margin_right {
		margin-right: 20rpx;
	}

	/*每个页面公共css */
	.mainbgc {
		background-color: #FAFAFA;
		min-height: calc(100vh);
	}

	.ffffff {
		background-color: #fff;
	}

	/* flex布局 */
	.flextop {
		display: flex;
		align-items: flex-start;
		justify-content: center;
	}

	.flextops {
		display: flex;
		align-items: flex-start;
	}

	.flexcenter {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.flexcolumn {
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
	}

	.flexbottom {
		display: flex;
		align-items: flex-end;
		justify-content: center;
	}

	.flexbetween {
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.flexleft {
		display: flex;
		align-items: center;
	}

	.flexright {
		display: flex;
		align-items: center;
		justify-content: flex-end;
	}

	.flexaround {
		display: flex;
		justify-content: space-around;
		align-items: center;
	}

	.flexstart {
		display: flex;
		justify-content: flex-start;
		align-items: flex-start;
	}

	.flex_wrap {
		flex-wrap: wrap;
	}

	/* 圆角 */
	.radius {
		border-radius: 20rpx;
	}

	/* 每个页面的背景色 */
	.bgcolor {
		background-color: #fafafa;
		min-height: 100vh;
	}

	// 消息
	.news {
		width: 38rpx;
		height: 38rpx;
		background-image: url("@/static/image/system/news.png");
		background-size: 100% 100%;
		position: relative;
	}

	// 扫一扫
	.scan {
		width: 36rpx;
		height: 36rpx;
		background-image: url("@/static/image/system/scan.png");
		background-size: 100% 100%;
	}

	.scan2 {
		width: 36rpx;
		height: 36rpx;
		background-image: url("@/static/image/system/scan2.png");
		background-size: 100% 100%;
	}

	.titletext {
		font-size: 32rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		line-height: 32rpx;
		color: #000000;
	}

	.strongtext {
		font-size: 28rpx;
		line-height: 28rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #000000;
	}

	.nostrongtext {
		font-size: 28rpx;
		line-height: 28rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		color: #333;
		word-break: break-all;
	}

	.margin_top1 {
		margin-top: 10rpx;
	}

	.flex1 {
		flex: 1;
	}

	.flex1s {
		flex: 1.5;
	}

	.flex2 {
		flex: 2;
	}

	// 下降箭头
	.downimage {
		width: 20rpx;
		height: 24rpx;
		background-image: url('@/static/image/system/downimage.png');
		background-size: 100% 100%;
	}

	// 上升箭头
	.upimage {
		width: 20rpx;
		height: 24rpx;
		background-image: url('@/static/image/system/upimage.png');
		background-size: 100% 100%;
	}

	// 下降箭头2
	.downimage2 {
		width: 28rpx;
		height: 17rpx;
		background-image: url('@/static/image/system/downimage2.png');
		background-size: 100% 100%;
	}

	// 上升箭头2
	.upimage2 {
		width: 28rpx;
		height: 17rpx;
		background-image: url('@/static/image/system/upimage2.png');
		background-size: 100% 100%;
	}

	// 下降箭头3
	.downimage3 {
		width: 26rpx;
		height: 36rpx;
		background-image: url('@/static/image/system/downimage3.png');
		background-size: 100% 100%;
	}

	// 时间
	.selecttime {
		width: 24rpx;
		height: 24rpx;
		background-image: url('@/static/image/system/selecttime.png');
		background-size: 100% 100%;
	}

	.selecttime_text {
		font-size: 24rpx;
		font-family: San Francisco Display-Medium, San Francisco Display;
		font-weight: 500;
		color: #666666;
	}

	// 选择时间盒子
	.selecttime_box {
		padding: 14rpx;
		border: 1rpx solid #e9e9e9;
	}

	// 向右箭头
	.righticon {
		width: 14rpx;
		height: 24rpx;
		background-image: url("@/static/image/system/righticon.png");
		background-size: 100% 100%;
	}

	.bottomjt {
		width: 24rpx;
		height: 14rpx;
		background-image: url("@/static/image/system/xiajiantou.png");
		background-size: 100% 100%;
	}

	.rightjt {
		width: 14rpx;
		height: 24rpx;
		background-image: url("@/static/image/system/rightjt2.png");
		background-size: 100% 100%;
	}

	.righticon2 {
		width: 12rpx;
		height: 20rpx;
		background-image: url("@/static/image/system/righticon2.png");
		background-size: 100% 100%;
	}

	.xiaocuohao {
		width: 30rpx;
		height: 30rpx;
		background-image: url("@/static/image/system/xiaocuohao.png");
		background-size: 100% 100%;
	}

	.greenlittle {
		width: 12rpx;
		height: 20rpx;
		background-image: url("@/static/image/system/greenlittle.png");
		background-size: 100% 100%;
	}

	// 下划线文字
	.textliner {
		background-image: url("@/static/image/office/textliner.png");
		background-size: 100% 100%;
	}

	// 标题栏右边内容
	.rightmsg_content {
		margin-top: 30rpx;
		height: 70rpx;
		position: absolute;
		top: 50rpx;
		right: 30rpx;
		font-size: 32rpx;
		/* padding-top: 110rpx; */
		padding-top: 32rpx;
		display: flex;
		align-items: center;
	}

	// 店铺图标
	.storeicon {
		width: 94rpx;
		height: 40rpx;
		background-image: url("@/static/image/system/merchsimg.png");
		background-size: 100% 100%;
	}

	// 个人图标
	.personicon {
		width: 94rpx;
		height: 40rpx;
		background-image: url("@/static/image/system/personimg.png");
		background-size: 100% 100%;
	}

	.yesbtn {
		margin: 30rpx;
		border-radius: 10rpx;
		background-color: #00B855;
		color: #fff;
		padding: 20rpx 30rpx;
		text-align: center;
		position: fixed;
		bottom: 30rpx;
		width: 630rpx;
	}

	// 地址图标
	.addressicon {
		width: 60rpx;
		height: 60rpx;
		background-image: url("@/static/image/system/addressicon.png");
		background-size: 100% 100%;
	}

	.dizhiimg {
		width: 24rpx;
		height: 24rpx;
		margin-left: 12rpx;
		margin-top: 14rpx;
		background-size: 100% 100%;
		background-image: url('@/static/image/system/wyqlittlephone.png');
	}

	.littleblue {
		width: 24rpx;
		height: 24rpx;
		margin-left: 8rpx;
		margin-top: 10rpx;
		background-size: 100% 100%;
		background-image: url('@/static/image/system/littleblue.png');
	}

	// 电话图标
	.phoneicon {
		width: 60rpx;
		height: 60rpx;
		background-image: url("@/static/image/system/phoneicon.png");
		background-size: 100% 100%;
	}

	.bluephone {
		width: 60rpx;
		height: 60rpx;
		background-image: url("@/static/image/system/bluephone.png");
		background-size: 100% 100%;
	}

	// 老板任务
	.bosstask {
		height: 40rpx;
		width: 160rpx;
		background-image: url("@/static/image/system/bosstask.png");
		background-size: 100% 100%;
	}

	// 自建任务
	.persontask {
		height: 40rpx;
		width: 160rpx;
		background-image: url("@/static/image/system/persontask.png");
		background-size: 100% 100%;
	}

	// 右上角加号
	.add {
		width: 36rpx;
		height: 38rpx;
		background-image: url("@/static/image/system/add.png");
		background-size: 100% 100%;
	}

	// 地址文字颜色
	.addresstext {
		margin-left: 10rpx;
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #00B855;
	}

	.selecticons {
		width: 30rpx;
		height: 30rpx;
		border-radius: 50%;
		border: 1rpx solid #0BBDCC;
		background-color: #0BBDCC;

		image {
			width: 20rpx;
			height: 12rpx;
			margin-bottom: 15rpx;
			margin-left: 5rpx;
		}
	}

	// 选中的单选按钮
	.selecticon {
		width: 30rpx;
		height: 30rpx;
		border-radius: 50%;
		border: 1rpx solid #00B855;
		background-color: #00B855;

		image {
			width: 20rpx; 
			height: 12rpx;
			margin-bottom: 15rpx;
			margin-left: 5rpx;
		}
	}
	.selectboxtop2 {
		width: 100%;
		padding: 12rpx 20rpx;
		height: 80rpx;
		line-height: 80rpx;
		box-sizing: border-box;
		background-color: #f7f9fa;
		border-radius: 50rpx;
	
		input {
			width: 80%;
			font-size: 24rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
		}
	}

	// 未选中的单选按钮
	.noselecticon {
		width: 30rpx;
		height: 30rpx;
		border-radius: 50%;
		border: 1rpx solid #999999;
	}

	// 选择
	.rightlable {
		padding: 6rpx 20rpx;
		background-color: #fff;
		background-color: #e7f9fa;
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #0BBDCB;
		line-height: 28rpx;
	}

	//确认按钮
	.surebtn {
		background-color: #00B855;
		border-radius: 50rpx;
		padding: 20rpx 0;
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #fff;
	}

	.surebtns {
		background: #00B855;
		border-radius: 50rpx;
		padding: 20rpx 0;
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #fff;
		text-align: center;
	}

	// 重置按钮
	.resetbtn {
		border-radius: 50rpx;
		padding: 20rpx 0;
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #0BBDCB;
	}

	// 必填项
	.bitian {
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FF0000;
	}

	// 选择地址
	.addressicon2 {
		width: 20rpx;
		height: 26rpx;
		background-image: url("@/static/image/system/addressicon2.png");
		background-size: 100% 100%;
	}

	// 搜索框内容
	.searchinput {
		background-color: #F3F3F3;
		border-radius: 50rpx;
		padding: 12rpx 20rpx;

		input {
			width: 100%;
		}
	}

	.searchimg {
		width: 24rpx;
		height: 24rpx;
		background-image: url("@/static/image/system/search.png");
		background-size: 100% 100%;
		margin-right: 30rpx;
	}

	.seletext {
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #999999;
		line-height: 28rpx;
	}

	// logo底部
	.logotoptext {
		font-size: 26rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #333333;
	}

	.logobottomtext {
		font-size: 26rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #666666;
	}

	.phoneicon2 {
		width: 16rpx;
		height: 16rpx;
		background-image: url("@/static/image/system/phone.png");
		background-size: 100% 100%;
		margin-right: 15rpx;
	}

	// 选中的图标
	.selectimage {
		width: 14rpx;
		height: 10rpx;
		position: absolute;
		right: 0;
		bottom: 0;
		background-image: url("@/static/image/system/selectimage.png");
		background-size: 100% 100%;
	}

	// 下拉箭头
	.xialaicon {
		width: 18rpx;
		height: 28rpx;
		background-image: url("@/static/image/system/xialaicon.png");
		background-size: 100% 100%;
	}

	// 三个点
	.diandiandian {
		width: 44rpx;
		height: 44rpx;
		background-image: url("@/static/image/system/diandd.png");
		background-size: 100% 100%;
	}

	.gongzuotai {
		width: 44rpx;
		height: 44rpx;
		background-image: url("@/static/image/system/gongzuotai3.png");
		background-size: 100% 100%;
	}

	.bigimg {
		width: 100%;
		margin-left: 30rpx;
	}

	.greenyes {
		width: 28rpx;
		height: 20rpx;
		background-image: url("@/static/image/system/duigou.png");
		background-size: 100% 100%;
	}

	// 问号
	.wenhao {
		width: 30rpx;
		height: 30rpx;
		background-image: url("@/static/image/system/wenhao.png");
		background-size: 100% 100%;
	}

	// 小右箭头
	.smallrighticon {
		width: 6rpx;
		height: 12rpx;
		background-image: url("@/static/image/system/smallrighticon.png");
		background-size: 100% 100%;
	}

	.redtext {
		color: #FF0000 !important;
	}

	// 顶部搜索
	.input-text {
		width: 588rpx;
		padding: 18rpx 0 18rpx 32rpx;
		background: rgba(153, 153, 153, .1);
		border-radius: 50rpx 50rpx 50rpx 50rpx;
		font-size: 26rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #999999;
	}

	.sousuo {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #0BBDCB;
	}

	// 员工档案头像圆角
	.userimg {
		width: 84rpx;
		height: 84rpx;
		margin-right: 30rpx;
		border-radius: 50%;
		position: relative;

		image {
			border-radius: 50%;
			width: 100%;
			height: 100%;
		}
	}

	// 地址选择
	.word12 {

		color: #808080;
		font-size: 32rpx;
	}

	.word13 {
		color: #000;
		font-size: 32rpx;
	}

	// 已取消
	.qxable {
		background-color: #ffb3b3;
		position: absolute;
		right: 0;
		top: 0;
		padding: 10rpx 30rpx;
		font-size: 20rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #ff0000;
		line-height: 23rpx;
		border-bottom-left-radius: 20rpx;
		border-top-right-radius: 20rpx;
	}

	.placeholderimage {
		width: 500rpx;
		height: 400rpx;
		margin-top: 300rpx;
		background-image: url("static/image/system/placeholderimage.png");
		background-size: 100% 100%;
	}

	.xiabiakuang {
		position: relative;
		padding-bottom: 30rpx;
		border-bottom: 2rpx solid rgba(153, 153, 153, .1);
		min-width: 500rpx;
	}

	.duihao {
		position: absolute;
		left: 0;
		background-image: url('@/static/image/system/duihao.png');
		width: 30rpx;
		height: 30rpx;
		background-size: 100% 100%;
	}

	.juzhong {
		text-align: center;
	}

	.zhengds {
		padding: 40rpx;
	}
</style>